import Home from '@/views/home/index';
import Login from '@/views/login/index';
import Counter from '@/views/test/index';
import Chat from '@/views/pages/chat';
import { Navigate } from 'react-router-dom'
// import React from 'react';

// const LazyLoad = (path: string) => {
//   const Comp = React.lazy(() => import(`@/views/${path}`))
//   return (

//     <React.Suspense fallback={<>加载中...</>}>
//       <Comp />
//     </React.Suspense>
//   )
// }


const routes = [
  {
    path: '/',
    element: <Navigate to="/home" />
  },
  {
    path: '/home',
    element: <Navigate to="/home" />
  },
  {
    path: '/home',
    element: <Home />,
  },
  {
    path: '/home/:id',
    element: <Home />,
    children: [
      {
        path: '/home/:id/chat',
        element: <Chat />
      },
      {
        path: '/home/:id/chat/:toid',
        element: <Chat />
      },
      {
        path: '/home/:id/chat/allfiand',
        element: <Chat />
      },

    ]
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: "/test",
    element: <Counter />
  }


]


export default routes


